import {
    SET_JIANSHEN
} from '../mutation-types';
import api from '../../api';

// import { errFun } from '../../tools.js'
const state = {
    code: [],
    data: [],
    message: [],
}
const mutations = {
        [SET_JIANSHEN](state, code, data, message) {
            state.code = code;
            state.data = data;
            state.message = message;
        }
    }
    // ACTION
const actions = {
    GET_JIANSHEN: ({ commit, dispatch }) => {
        //让loading界面显示
        // dispatch('CHANGE_LOADING_SHOW').then(
        api.getJianshen().then(response => {
                commit(SET_JIANSHEN, { code: response.code, data: response.result, message: response.message });
                // 关闭loading界面
                // dispatch('HIDDEN_LOADING_SHOW')
            })
            // )
    }
}
export default {
    state,
    actions,
    mutations
}